A5.u.coloradjust Method
Syntax
A5.u.color.adjust(color,part,value)
A5.u.color.adjust(color,adjustments)
Returns
- colorobject
The color components.
- rnumber
The "red" value of the color.
- gnumber
The "green" value of the color.
- bnumber
The "blue" value of the color.
- hnumber
The "hue" value of the color.
- snumber
The "saturation" value of the color.
- lnumber
The "luminance" value of the color.
- anumber
The "alpha" value of the color.
- colorobject
The color to adjust.
- partstring
The name of the part to adjust. Values can be "r", "g", "b", "h", "s", "l" and "a". A value of "in" and "out" can be used to adjust the "l" part in (towards "50%") or out (away from "50%").
- valuenumberstring
The value to set the color part to. A number passed in as a string prefix with a "+" or "-", can be used to make relative adjustments.
- adjustmentsobject
Adjustments to the color components.
- rnumberstring
The adjustments to the "red" value of the color.
- gnumberstring
The adjustments to the "green" value of the color.
- bnumberstring
The adjustments to the "blue" value of the color.
- hnumberstring
The adjustments to the "hue" value of the color.
- snumberstring
The adjustments to the "saturation" value of the color.
- lnumberstring
The adjustments to the "luminance" value of the color.
- anumber
The adjustments to the "alpha" value of the color.
Description
Adjust values in a color object.
Discussion
This method will take a color object (such as the one returned from A5.u.color.prase) and adjust specific parts of the color, while updating the other parts that are effected.
Example
var c = A5.u.color.parse('rgb(100,50,0)'); // c = {"h":30,"s":100,"l":19.61,"r":100,"g":50,"b":0,"a":1} A5.u.color.adjust(c,'h','+10'); // c = {"h":40,"s":100,"l":19.61,"r":100,"g":67,"b":0,"a":1} A5.u.color.adjust(c,'in',15); // c = {"h":40,"s":100,"l":34.61,"r":177,"g":118,"b":0,"a":1}